<?php
$intAlbumId		= $objRequest->getParam('albumid',0);
$intImageId		= $objRequest->getParam('imageid',0);
$intPageA		= $objRequest->getParam('apage',1);
$intLimitA		= 1;
$intOffsetA		= ($intPageA - 1) * $intLimitA;
$objPhoto		= new Photo();
$objBehaviour	= new Behaviour();
$intTotalA		= 0;
if($AppUI->id) {
	$objBehaviour->updateRead($AppUI->id,$intImageId,2,22);
}
$arrImageFull	= $objPhoto->getImageByAlbumId($intUserId,$intAlbumId,PHOTO_ALBUM_DETAIL_LIMIT,$intTotalA);
if($intImageId == 0) {
	$arrImage		= array_slice($arrImageFull,$intOffsetA,$intLimitA);
	$arrImage		= isset($arrImage[0]) ? $arrImage[0] : null;
	$intImageId		= isset($arrImage['imageid']) ? $arrImage['imageid'] : 0;
} else {
	$arrImage		= $objPhoto->getPhoto($objUser->id,$intImageId);
}
if(isset($intCheckView) && $intCheckView == 1) {
	if($arrImage) {
		$objVfriendUser		= new Vfriend_User();	
		$intTypeRelation	= $objVfriendUser->getRelationType($objUser->id,$AppUI->id);
		if(($intTypeRelation < 2 && $arrImage['perm'] == 1) || ($arrImage['perm'] == 2 && $objUser->id != $AppUI->id && $AppUI->id > 0)) {
			$strMessage	= $arrMessage[7];
			$strMessage	= str_replace('[strFullname]', $objUser->fullnamevn, $strMessage);
			$strRefer	= Vfriend_Function::linkFullhouseForPhoto($objUser->username,$objUser->hex);
			Vfriend_Function::setMsg($strMessage);
			Vfriend_Function::redirect($strRefer);
		}
	} else {
		$strRefer	= Vfriend_Function::linkFullhouseForPhoto($objUser->username,$objUser->hex);
		Vfriend_Function::setMsg($arrMessage[8]);
		Vfriend_Function::redirect($strRefer);
	}
}
$this->view->arrImage	= $arrImage;
$this->view->intTotalA	= $intTotalA;
$this->view->intOffsetA	= $intOffsetA;
$this->view->intLimitA	= $intLimitA;
$this->view->intPageA	= $intPageA;
include_once('fullhouse/box-album-comment.php');
?>